package com.pucong.gitee.database.backup.common.entity.sys.authorize;

import com.pucong.gitee.database.backup.common.selfenum.LicenceTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@ApiModel("授权信息")
public class AuthorizeInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("mac地址")
    private String mac;

    @ApiModelProperty("认证类型")
    private LicenceTypeEnum licType;

    @ApiModelProperty("serverKey")
    private String serverKey;

    @ApiModelProperty("过期时间")
    private Date expireDate;

    @ApiModelProperty("加密内容")
    private byte[] signature;

    /**
     * 校验是否过期
     * @return
     */
    public Boolean isExpired(){
        Date date = new Date();
        if(date.getTime() > this.expireDate.getTime()){
            return true;
        }
        return false;
    }
}